package com.example.sunjian.myapplication;

import android.test.AndroidTestCase;
import android.util.Log;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 作者：sunjian on 16/6/30 17:22
 * 邮箱：sunjian@cyhz.com
 */
public class FilterTest extends AndroidTestCase {


    @Override
    protected void setUp() throws Exception {
        super.setUp();
    }


    public void testFilter(){
        String msg = "@人名 @还是人名 求购啊亲，还有 @又是人名 @ 这个不是";
        Pattern pt = Pattern.compile("@\\S+?\\s");
        Matcher mt = pt.matcher(msg);
        while (mt.find()) {

            Log.e("sj","result:"+mt.group().trim());
        }

    }
}
